/*
MockO: FuDePAN's Mocking Operations
    Copyright (C) 2012  Daniel Gutson, FuDePAN

    This file is part of MockO.

    MockO is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    MockO is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with MockO.  If not, see <http://www.gnu.org/licenses/>.

    This is the file containing the function to test.
*/

#include <stdlib.h>
#include <string.h>
#include "example.h"

int functionToMock1(int x)
{
    return x + 1;
}

int functionToMock2(int x)
{
    return x - 1;
}

int functionToMock3(const string& str)
{
    return str.size() * 2;
}

void functionToMock4(int& x)
{
    x++;
}

int functionToMock5(void)
{
    return 41;
}

int functionToMock6(Answers answer)
{
    return answer;
}

int functionToTest(int x)
{
    return functionToMock1(x) + functionToMock2(x);
}

int functionToTest2(const string& question)
{
    return functionToMock3("123456789012345678901");
}

int functionToTest3(void)
{
    int x = functionToMock5();
    functionToMock4(x);
    return x;
}

char* functionToTest4(void)
{
    static const char question[] = "The answer is 42";
    char* const ret = (char*)malloc(sizeof(question));
    if (ret != NULL)
        strcpy(ret, question);
    return ret;
}

int functionToTest5(void)
{
    return functionToMock6(RightAnswer);
}

